package it.ap.sa.acqua.tank.service.converter;

import org.springframework.stereotype.Component;

import it.ap.sa.acqua.dao.beans.TTankTypeAlertBean;
import it.ap.sa.acqua.dao.model.TTankTypeAlert;
import it.ap.sa.core.util.IBeanPopulate;

/**
 * Converter tra {@link TTankTypeAlert} e {@link TTankTypeAlertBean}
 * @author Alessandro Paolillo
 * @date 21 ott 2016
 * @version 1.0
 */
@Component
public class TankTypeAlertConverter implements IBeanPopulate<TTankTypeAlert, TTankTypeAlertBean>{

	public TankTypeAlertConverter() {
	}

	/**
	 * @author Alessandro Paolillo
	 * @date 21 ott 2016
	 * @version 1.0
	 * @see it.eng.tz.core.util.IBeanPopulate#convertdbToPage(java.lang.Object)
	 */
	@Override
	public TTankTypeAlertBean convertdbToPage(TTankTypeAlert src) throws Exception {
		TTankTypeAlertBean result = new TTankTypeAlertBean();
		if (src.getId()!=null) result.setId(src.getId());
		if (src.getNome()!=null) result.setNome(src.getNome());
		return result;
	}
	
	/**
	 * @author Alessandro Paolillo
	 * @date 21 ott 2016
	 * @version 1.0
	 * @see it.eng.tz.core.util.IBeanPopulate#convertpageToDb(java.lang.Object)
	 */
	@Override
	public TTankTypeAlert convertpageToDb(TTankTypeAlertBean src) throws Exception {
		TTankTypeAlert result = new TTankTypeAlert();
		if (src.getId()!=null) result.setId(src.getId());
		if (src.getNome()!=null) result.setNome(src.getNome());
		return result;
	}

}
